#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <map>
#include <vector>

//等于号不能少
using namespace std;
using LL = long long;
const int N = 1010;

int n, m;
int phi[N];
int prime[N], cnt;
bool st[N];

void init(int n){
    phi[1] = 1;
    for(int i = 2; i <= n; i ++){
        if(!st[i]){
            phi[i] = i - 1;
            prime[cnt ++] = i;
        }

        for(int j = 0; prime[j] <= n / i; j ++){
            st[i * prime[j]] = true;
            if(i % prime[j] == 0){
                phi[i * prime[j]] = phi[i] * prime[j];
                break;
            }
            phi[i * prime[j]] = phi[i] * (prime[j] - 1);
        }
    }
}


int main(){
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    init(N - 1);
    cin >> m;
    for(int T = 1; T <= m; T++){
        cin >> n;
        int res = 1;
        for(int i = 1; i <= n; i ++) res += phi[i] * 2;
        cout << T << " " << n << " " << res << endl;
    }
    

    return 0;
}